﻿using UnityEngine;
using UnityEditor;
using System;

public class UIEventIntercept
{
    ///使用时打开下面的注释

   // [InitializeOnLoadMethod]
    static void Start()
    {
        Action OnEvent = delegate {
			Event e = Event.current;
 
			switch (e.type) {
                //case EventType.mouseDown:
                //    Debug.Log("mousedown");
                //    e.Use();
                //    break;
                //case EventType.mouseUp:
                //    Debug.Log("mouseup");
                //    e.Use();
                //    break;
                //case EventType.MouseMove:
                //    Debug.Log("move");
                //    e.Use();
                //    break;
			case EventType.DragPerform:
				//Debug.Log ("DragPerform");
				e.Use ();
				break;
			case EventType.DragUpdated:
				//Debug.Log ("DragUpdated");
				e.Use ();
				break;
			case EventType.DragExited:
				//Debug.Log ("DragExited");
				e.Use ();
				break;
			}
		};
 
 
		EditorApplication.hierarchyWindowItemOnGUI = delegate(int instanceID, Rect selectionRect) {
 
			OnEvent();
 
		};
 
		EditorApplication.projectWindowItemOnGUI = delegate(string guid, Rect selectionRect) {
	
			OnEvent();
		};
	
	}
}
